<?php
    // 搜索成员信息
    header("Content-type:text/html;charset=utf-8");
    $mysqli = new mysqli("localhost","root","root","materialadmin");
    if($mysqli->connect_errno != 0){
        die();
    };

    $role = $_GET["type1"];
    // print_r($role);


    $sql = "select * from rolemanagement where role='{$role}'";

    $res = $mysqli->query($sql);
    
    // print_r($res);
    if($res->num_rows > 0){
        for($i = 0; $i < $res->num_rows; $i++){
            $list[] = $res->fetch_assoc();
        }
        $data["code"] = 1;
        $data["list"] = $list;
    }else{
        $data["code"] = 0;
    }
    // print_r(json_encode($list));
    print_r(json_encode($data));
?>